package com.sanjin.mall.common.exception;


import lombok.Data;

/**
 *  该类是Service层的通用exception类，一些业务操作在检查出错误后，可手动抛出此错误给controller，并附加上错误message
 *  在controller层使用try-catch进行捕获，并将message返回前端
 */
@Data
public class CommonServiceException extends RuntimeException{

    BizCodeEnume resultCode;

    public CommonServiceException(BizCodeEnume resultCode){
        super(resultCode.getMsg());
        this.resultCode = resultCode;
    }

    public CommonServiceException(BizCodeEnume resultCode, String message){
        super(message);
        this.resultCode = resultCode;
    }
}
